/*
 * @Author: wangc
 * @Date: 2021-03-15 12:54:06
 * @Description: 成品管理
 */
import { request } from '@/utils/request'

//任务用户状态枚举
export function checkStatusEnum(key) {
    let dic = {
        0: "禁用",
        1: "审核中",
        2: "通过",
        3: "驳回",
    }
    return dic[key] ? dic[key] : "未知"
}

// 码单列表
export function getClothNoteList(data, callBack) {
    return request({
        url: '/cloth_note/list',
        method: 'get',
        data,
        isYarn: true,
    }, callBack)
}

// 扫成品码
export function getClothNoteScan(data, callBack) {
    return request({
        url: '/cloth_note/scan',
        method: 'get',
        data,
        isYarn: true,
        isFlag: true
    }, callBack)
}

// 新增码单
export function getClothNoteScanAdd(data, callBack) {
    return request({
        url: '/cloth_note/scan_to_bind',
        method: 'post',
        data,
        isYarn: true,
        type: 'json'
    }, callBack)
}

// 成品扫码单获取坯布信息
export function getClothPubGet(data, callBack) {
    return request({
        url: '/grey_cloth/get',
        method: 'get',
        data,
        isYarn: true,
        isId: true
    }, callBack)
}

// 码单详情
export function getClothNoteDetails(data, callBack) {
    return request({
        url: '/cloth_note/note_detail',
        method: 'get',
        data,
        isYarn: true,
    }, callBack)
}

// 删除码单数据
export function getClothNoteDel(data, callBack) {
    return request({
        url: '/cloth_note/scan_to_unbind',
        method: 'post',
        data,
        isYarn: true,
        isFile: true
    }, callBack)
}

// 确认接收
export function getClothNoteReceiveNote(data, callBack) {
    return request({
        url: '/cloth_note/receive_note',
        method: 'post',
        data,
        isYarn: true,
        isFile: true
    }, callBack)
}

// 客户信息 列表
export function getCustomerInfoList(data, callBack) {
    return request({
        url: '/customer_info/list',
        method: 'get',
        data,
        isYarn: true
    }, callBack)
}

//客户渠道
export function loadCustomerChannelData(data, callBack) {
    return request({
        url: "/customer_info/list_channel",
        method: 'get',
        data,
        isYarn: true
    }, callBack);
}

// 成品接收区域
export function getClothNoteReceive(data, callBack) {
    return request({
        url: '/cloth_note/receive_area',
        method: 'get',
        data,
        isYarn: true
    }, callBack)
}

// 成品区域
export function getClothNoteAreas(data, callBack) {
    return request({
        url: '/product_cloth_store/areas',
        method: 'get',
        data,
        isYarn: true
    }, callBack)
}


// 成品码单扫码
export function getClothNoteByScan(data, callBack) {
    return request({
        url: '/cloth_note/scan_note',
        method: 'get',
        data,
        isYarn: true,
        isId: true
    }, callBack)
}

// 成品盘库列表
export function getProductStoreList(data, callBack) {
    return request({
        url: '/product_cloth_store/check_list',
        method: 'get',
        data,
        isYarn: true,
    }, callBack)
}

// 盘库选择品名
export function getProductFilterTopNo(data, callBack) {
    return request({
        url: '/grey_cloth_store/filter_top_no',
        method: 'get',
        data,
        isYarn: true,
    }, callBack)
}

// 成品盘库 
export function getProductStoreCheck(data, callBack) {
    return request({
        url: '/product_cloth_store/check',
        method: 'post',
        data,
        isYarn: true,
        type: 'json'
    }, callBack)
}

// 成品盘库详情
export function getProductStoreCheckDetail(data, callBack) {
    return request({
        url: '/product_cloth_store/check_detail',
        method: 'get',
        data,
        isYarn: true,
    }, callBack)
}

// 码单扫盘库码信息
export function getProductStoreScanCheckDetail(data, callBack) {
    return request({
        url: '/product_cloth_store/scan_check',
        method: 'get',
        data,
        isYarn: true,
    }, callBack)
}

// 成品信息
export function getProductInfo(data, callBack) {
    return request({
        url: '/sample_design/get',
        method: 'get',
        data,
        isYarn: true,
        isId: true
    }, callBack)
}

//topNo获取设计Id 
export function filterDesignByNo(data, callBack) {
    return request({
        url: '/sample_design/filter_list',
        method: 'get',
        data,
        isYarn: true,
    }, callBack)
}

// 成品跟踪列表
export function getProductViewsList(data, callBack) {
    return request({
        url: '/product_cloth_store/list_4_view',
        method: 'get',
        data,
        isYarn: true
    }, callBack)
}

// 成品颜色汇总
export function loadProductColorStoreData(data, callBack) {
    return request({
        url: '/product_cloth_store/list_4_color',
        method: 'get',
        data,
        isYarn: true
    }, callBack)
}

// 成品缸号汇总
export function getProductVatList(data, callBack) {
    return request({
        url: '/product_cloth_store/list_4_vat',
        method: 'get',
        data,
        isYarn: true
    }, callBack)
}


// 成品区域汇总
export function getProductAreaList(data, callBack) {
    return request({
        url: '/product_cloth_store/list_4_area',
        method: 'get',
        data,
        isYarn: true
    }, callBack)
}

// 成品预计匹数汇总
export function getProductExceptList(data, callBack) {
    return request({
        url: '/product_cloth_store/list_4_except',
        method: 'get',
        data,
        isYarn: true
    }, callBack)
}

//获取成品信息
export function clothNoteDetail(data, callBack) {
    return request({
        url: '/cloth_note/detail',
        method: 'get',
        data,
        isYarn: true,
        isFlag: true
    }, callBack)
}

//编辑产品图
export function editProductPic(data, callback) {
    return request({
        url: "/sample_design/edit_product_pic",
        method: "post",
        data,
        isYarn: true,
        isFile: true,
    }, callback);
}

//成品冻结
export function addToFreeze(data, callback) {
    return request({
        url: "/product_cloth_freeze/add_by_cloth",
        method: "post",
        data,
        isYarn: true,
        isFile: true,
    }, callback);
}

//加载冻结数据
export function loadFreezeData(data, callBack) {
    return request({
        url: '/product_cloth_freeze/list',
        method: 'get',
        data,
        isYarn: true,
    }, callBack);

    // return callBack({"totalRow":12,"pageNumber":1,"totalPage":1,"pageSize":30,"list":[{"cancellerName":"","designSeqNo":1000,"greyClothId":16682,"cancellerId":0,"id":1176,"colorNo":"0999","operatorId":4,"operatorName":"隔壁老王","operateAt":"2022-09-07 19:03:39","problemRemark":"fda","designNo":"05851-圭-A-6毛圈布","status":1},{"cancellerName":"","designSeqNo":101,"greyClothId":16827,"cancellerId":0,"id":1180,"colorNo":"0999","operatorId":4,"operatorName":"隔壁老王","operateAt":"2022-09-07 19:07:24","problemRemark":"dddddd","designNo":"02023-X全毛单面立顺","status":3},{"cancellerName":"","designSeqNo":1000,"greyClothId":26397,"cancellerId":0,"id":1177,"colorNo":"0999","operatorId":4,"operatorName":"隔壁老王","operateAt":"2022-09-07 19:03:39","problemRemark":"fda","designNo":"05851-V-9毛圈布","status":3},{"cancellerName":"","designSeqNo":105,"greyClothId":16837,"cancellerId":0,"id":1183,"colorNo":"0999","operatorId":4,"operatorName":"隔壁老王","operateAt":"2022-09-07 19:07:47","problemRemark":"ddddddd","designNo":"02023-X全毛单面立顺","status":2},{"cancellerName":"","designSeqNo":1001,"greyClothId":26429,"cancellerId":0,"id":1178,"colorNo":"0999","operatorId":4,"operatorName":"隔壁老王","operateAt":"2022-09-07 19:03:39","problemRemark":"fda","designNo":"05851-V-9毛圈布","status":2},{"cancellerName":"","designSeqNo":104,"greyClothId":16883,"cancellerId":0,"id":1184,"colorNo":"0999","operatorId":4,"operatorName":"隔壁老王","operateAt":"2022-09-07 19:07:47","problemRemark":"ddddddd","designNo":"02023-X全毛单面立顺","status":2},{"cancellerName":"","designSeqNo":106,"greyClothId":16910,"cancellerId":0,"id":1185,"colorNo":"0999","operatorId":4,"operatorName":"隔壁老王","operateAt":"2022-09-07 19:07:47","problemRemark":"ddddddd","designNo":"02023-X全毛单面立顺","status":2},{"cancellerName":"","designSeqNo":103,"greyClothId":16931,"cancellerId":0,"id":1186,"colorNo":"0999","operatorId":4,"operatorName":"隔壁老王","operateAt":"2022-09-07 19:07:47","problemRemark":"ddddddd","designNo":"02023-X全毛单面立顺","status":2},{"cancellerName":"","designSeqNo":100,"greyClothId":16856,"cancellerId":0,"id":1181,"colorNo":"0999","operatorId":4,"operatorName":"隔壁老王","operateAt":"2022-09-07 19:07:24","problemRemark":"dddddd","designNo":"02023-X全毛单面立顺","status":2},{"cancellerName":"","designSeqNo":102,"greyClothId":16866,"cancellerId":0,"id":1182,"colorNo":"0999","operatorId":4,"operatorName":"隔壁老王","operateAt":"2022-09-07 19:07:24","problemRemark":"dddddd","designNo":"02023-X全毛单面立顺","status":2},{"cancellerName":"隔壁老王","designSeqNo":1001,"cancelAt":"2022-09-07 19:05:31","operatorName":"隔壁老王","operateAt":"2022-09-07 19:05:28","greyClothId":16569,"cancellerId":4,"id":1179,"colorNo":"0999","operatorId":4,"problemRemark":"dddd","designNo":"05851-圭-A-6毛圈布","status":2},{"cancellerName":"隔壁老王","designSeqNo":1001,"cancelAt":"2022-09-07 19:04:44","operatorName":"隔壁老王","operateAt":"2022-09-07 19:03:39","greyClothId":16569,"cancellerId":4,"id":1175,"colorNo":"0999","operatorId":4,"problemRemark":"fda","designNo":"05851-圭-A-6毛圈布","status":2}]});
}

//删除成品冻结数据
export function delFreezeData(data, callback) {
    return request({
        url: "/product_cloth_freeze/del",
        method: "post",
        data,
        isYarn: true,
        isFile: true,
    }, callback);
}

//解冻成品冻结数据
export function cancelFreezeData(data, callback) {
    return request({
        url: "/product_cloth_freeze/cancel",
        method: "post",
        data,
        isYarn: true,
        isFile: true,
    }, callback);
}

//增加剪样
export function addProductSampleCut(data, callback) {
    return request({
        url: "/product_sample_cut/add",
        method: "post",
        data,
        isYarn: true,
        type: 'json'
    }, callback);
}

//加载剪样
export function loadSampleCutData(data, callback) {
    return request({
        url: '/product_sample_cut/list',
        method: 'get',
        data,
        isYarn: true,
    }, callback);
}

//删除剪样数据
export function delSampleData(data, callback) {
    return request({
        url: "/product_sample_cut/del",
        method: "post",
        data,
        isYarn: true,
        isFile: true,
    }, callback);
}

//客户退货
export function customerReturn(data, callback) {
    return request({
        url: "/cloth_note/customer_return",
        method: "post",
        data,
        isYarn: true,
        type: "json"
    }, callback);
}

//客户退货列表
export function loadCustomerReturnData(data, callback) {
    return request({
        url: "/cloth_note/list_customer_return_record",
        method: "get",
        data,
        isYarn: true,
        isFile: true,
    }, callback);
}

//增加剪样 从盘库
export function addProductSampleCutByStoreCheck(data, callback) {
    return request({
        url: "/product_sample_cut/add_by_store_check",
        method: "post",
        data,
        isYarn: true,
        type: 'json'
    }, callback);
}

//成品预检
export function preCheckProduct(data, callback) {
    return request({
        url: "/product_pre_check/check",
        method: "post",
        data,
        isYarn: true,
        type: 'json'
    }, callback);
}

//成品预检列表
export function loadPreCheckProductData(data, callback) {
    return request({
        url: "/product_pre_check/list",
        method: "get",
        data,
        isYarn: true,
        isFile: true,
    }, callback);
}

//成品预检
export function cancelPreCheckProduct(data, callback) {
    return request({
        url: "/product_pre_check/cancel",
        method: "post",
        data,
        isYarn: true,
        isFile: true,
    }, callback);
}

//重新缓存布样颜色
export function reCacheSampleColor(data, callback) {
    return request({
        url: '/product_sample/re_cache_color',
        method: 'get',
        data,
        isYarn: true,
    }, callback);
}

//过滤布样颜色
export function filterSampleColor(data, callback) {
    return request({
        url: '/product_sample/filter_color',
        method: 'get',
        data,
        isYarn: true,
    }, callback);
}

//加载布样
export function loadSampleData(data, callback) {
    return request({
        url: '/product_sample/list',
        method: 'get',
        data,
        isYarn: true,
    }, callback);
}

//增加成品布样
export function addProductSample(data, callback) {
    return request({
        url: "/product_sample/add",
        method: "post",
        data,
        isYarn: true,
        type: 'json',
        isEmpty: true,
    }, callback);
}

//编辑成品布样
export function editProductSample(data, callback) {
    return request({
        url: "/product_sample/edit",
        method: "post",
        data,
        isYarn: true,
        type: 'json',
        isEmpty: true,
    }, callback);
}

//删除成品布样
export function delProductSample(data, callback) {
    return request({
        url: "/product_sample/del",
        method: "post",
        data,
        isYarn: true,
        isFile: true,
    }, callback);
}


//增加剪样 从外购
export function addProductSampleCutByOutsource(data, callback) {
    return request({
        url: "/product_sample_cut/add_by_outsource",
        method: "post",
        data,
        isYarn: true,
        type: 'json'
    }, callback);
}

//增加剪样 按坯布
export function addProductSampleCutByGreyCloth(data, callback) {
    return request({
        url: "/product_sample_cut/add_by_grey_cloth",
        method: "post",
        data,
        isYarn: true,
        type: 'json'
    }, callback);
}

//成品销布出库
export function productClothOutByDestroy(data, callback) {
    return request({
        url: "/product_cloth_store/destroy_cloth",
        method: "post",
        data,
        isYarn: true,
        isFile: true,
    }, callback);
}

//成品取消销布入库
export function productClothInByDestroy(data, callback) {
    return request({
        url: "/product_cloth_store/cancel_destroy_cloth",
        method: "post",
        data,
        isYarn: true,
        isFile: true,
    }, callback);
}

//加载成品剪样详情
export function queryProductSampleCutDetail(data, callback) {
    return request({
        url: "/product_sample_cut/detail",
        method: "get",
        data,
        isYarn: true,
        isId: true
    }, callback);
}

//客户退剪样
export function customerReturnSampleCut(data, callback) {
    return request({
        url: "/product_sample_cut/customer_return",
        method: "post",
        data,
        isYarn: true,
        isFile: true,
    }, callback);
}

//增加剪样 从退货剪样
export function addProductSampleCutBySampleCut(data, callback) {
    return request({
        url: "/product_sample_cut/add_by_sample_cut",
        method: "post",
        data,
        isYarn: true,
        type: 'json'
    }, callback);
}